From 6e7b50d22982d82eb5cf16d5abbbae11310798a6 Mon Sep 17 00:00:00 2001 From: robertl Date: Thu, 5 Jul 2007 01:42:58 +0000 Subject: [PATCH] Add ISO_TIME_MS to Style formats. --- gpsbabel/csv_util.c | 10 ++++++++-- gpsbabel/xmldoc/chapters/styles.xml | 17 +++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/gpsbabel/csv_util.c b/gpsbabel/csv_util.c index 3baa9187e..e3389376f 100644 --- a/gpsbabel/csv_util.c +++ b/gpsbabel/csv_util.c @@ -27,6 +27,7 @@ #include "grtcirc.h" #include "strptime.h" #include "jeeps/gpsmath.h" +#include "xmlgeneric.h" // for xml_fill_in_time. #define MYNAME "CSV_UTIL" @@ -938,8 +939,9 @@ xcsv_parse_val(const char *s, waypoint *wpt, const field_map_t *fmp) (strcmp(fmp->key, "HMSL_TIME") == 0) ) { wpt->creation_time += addhms(s, fmp->printfc); } else - if (strcmp(fmp->key, "ISO_TIME") == 0) { - wpt->creation_time = xml_parse_time(s, NULL); + if ((strcmp(fmp->key, "ISO_TIME") == 0) || + (strcmp(fmp->key, "ISO_TIME_MS") == 0)) { + wpt->creation_time = xml_parse_time(s, &wpt->microseconds); } else if (strcmp(fmp->key, "GEOCACHE_LAST_FOUND") == 0) { wpt->gc_data.last_found = yyyymmdd_to_time(s); @@ -1457,6 +1459,10 @@ xcsv_waypt_pr(const waypoint *wpt) if (strcmp(fmp->key, "ISO_TIME") == 0) { writetime(buff, sizeof buff, "%Y-%m-%dT%H:%M:%SZ", wpt->creation_time, 1 ); } else + if (strcmp(fmp->key, "ISO_TIME_MS") == 0) { + xml_fill_in_time(buff, wpt->creation_time, + MICRO_TO_MILLI(wpt->microseconds), XML_LONG_TIME); + } else if (strcmp(fmp->key, "GEOCACHE_LAST_FOUND") == 0) { writebuff(buff, fmp->printfc, time_to_yyyymmdd(wpt->gc_data.last_found)); } else diff --git a/gpsbabel/xmldoc/chapters/styles.xml b/gpsbabel/xmldoc/chapters/styles.xml index ca1c1f27b..199e91b6a 100644 --- a/gpsbabel/xmldoc/chapters/styles.xml +++ b/gpsbabel/xmldoc/chapters/styles.xml @@ -900,6 +900,23 @@ example: +
+ISO_TIME_MS + + ISO_TIME_MS is much like ISO_TIME, but expresses milliseconds at the + end of the timestamp. + It is thus in the format yyyy-mm-ddThh:mm:ss.SSSzzzzz + where 'SSS' is milliseconds and zzzzzz is the local time offset + or the character Z for UTC time. + On output, UTC 'Z' time zone will always be used. + + +example: + + IFIELD ISO_TIME_MS,"","%s" + +
+
GEOCACHE_DIFF -- 2.30.2